package com.xwli.jdk8new.lambda.test;

import com.xwli.jdk8new.lambda.service.UserService;

/**
 * @program: springcloud
 * @description: 无参无返回结果的案例
 * @author: xwli
 * @create: 2022-05-05 16:47
 **/
public class LambdaDemo02 {
    public static void main(String[] args) {
        // 接口内只能有一个抽象方法
        goShow(new UserService() {
            @Override
            public void show() {
                System.out.println("匿名内部类冗余写法");
            }
        });
        System.out.println("-------------------------------");
        goShow(()->{System.out.println("Lambda写法");});
    }

    public static void goShow(UserService userService){
        userService.show();
    }
}
